package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.util.Date;

/**
 * 查询模板表：存储查询条件模板
 * @TableName query_template
 */
@TableName(value ="query_template")
@Data
public class QueryTemplate {
    /**
     * 模板ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 模板名称
     */
    private String templateName;

    /**
     * 查询类型
     */
    private String queryType;

    /**
     * 用户账号
     */
    private String userAccount;

    /**
     * 关区代码
     */
    private String customsCode;

    /**
     * 进出口类型
     */
    private String importExportType;

    /**
     * 结关开始日期
     */
    private Date customsClearanceStartDate;

    /**
     * 结关结束日期
     */
    private Date customsClearanceEndDate;

    /**
     * 分组维度列表（JSON格式）
     */
    private String groupDimensions;

    /**
     * 输出字段列表（JSON格式）
     */
    private String outputFields;

    /**
     * 筛选条件（JSON格式）
     */
    private String filterConditions;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        QueryTemplate other = (QueryTemplate) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getTemplateName() == null ? other.getTemplateName() == null : this.getTemplateName().equals(other.getTemplateName()))
            && (this.getQueryType() == null ? other.getQueryType() == null : this.getQueryType().equals(other.getQueryType()))
            && (this.getUserAccount() == null ? other.getUserAccount() == null : this.getUserAccount().equals(other.getUserAccount()))
            && (this.getCustomsCode() == null ? other.getCustomsCode() == null : this.getCustomsCode().equals(other.getCustomsCode()))
            && (this.getImportExportType() == null ? other.getImportExportType() == null : this.getImportExportType().equals(other.getImportExportType()))
            && (this.getCustomsClearanceStartDate() == null ? other.getCustomsClearanceStartDate() == null : this.getCustomsClearanceStartDate().equals(other.getCustomsClearanceStartDate()))
            && (this.getCustomsClearanceEndDate() == null ? other.getCustomsClearanceEndDate() == null : this.getCustomsClearanceEndDate().equals(other.getCustomsClearanceEndDate()))
            && (this.getGroupDimensions() == null ? other.getGroupDimensions() == null : this.getGroupDimensions().equals(other.getGroupDimensions()))
            && (this.getOutputFields() == null ? other.getOutputFields() == null : this.getOutputFields().equals(other.getOutputFields()))
            && (this.getFilterConditions() == null ? other.getFilterConditions() == null : this.getFilterConditions().equals(other.getFilterConditions()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getTemplateName() == null) ? 0 : getTemplateName().hashCode());
        result = prime * result + ((getQueryType() == null) ? 0 : getQueryType().hashCode());
        result = prime * result + ((getUserAccount() == null) ? 0 : getUserAccount().hashCode());
        result = prime * result + ((getCustomsCode() == null) ? 0 : getCustomsCode().hashCode());
        result = prime * result + ((getImportExportType() == null) ? 0 : getImportExportType().hashCode());
        result = prime * result + ((getCustomsClearanceStartDate() == null) ? 0 : getCustomsClearanceStartDate().hashCode());
        result = prime * result + ((getCustomsClearanceEndDate() == null) ? 0 : getCustomsClearanceEndDate().hashCode());
        result = prime * result + ((getGroupDimensions() == null) ? 0 : getGroupDimensions().hashCode());
        result = prime * result + ((getOutputFields() == null) ? 0 : getOutputFields().hashCode());
        result = prime * result + ((getFilterConditions() == null) ? 0 : getFilterConditions().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", templateName=").append(templateName);
        sb.append(", queryType=").append(queryType);
        sb.append(", userAccount=").append(userAccount);
        sb.append(", customsCode=").append(customsCode);
        sb.append(", importExportType=").append(importExportType);
        sb.append(", customsClearanceStartDate=").append(customsClearanceStartDate);
        sb.append(", customsClearanceEndDate=").append(customsClearanceEndDate);
        sb.append(", groupDimensions=").append(groupDimensions);
        sb.append(", outputFields=").append(outputFields);
        sb.append(", filterConditions=").append(filterConditions);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append("]");
        return sb.toString();
    }
}